package com.aaa.controller;

import com.aaa.entity.Order;
import com.aaa.service.OrderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * (Order)表控制层
 *
 * @author makejava
 * @since 2022-01-12 13:27:05
 */
@RestController
@RequestMapping("order")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderService orderService;

    /**
     * 通过主键查询单条数据
     *
//     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public Order selectOne(Integer id) {
        return this.orderService.queryById(id);
    }
 //分页查询订单
    @RequestMapping("selectOrder")
    public List<Order> selectOrder(Integer pageNum,Integer pageSize){
        List<Order> OrderList=orderService.queryAllByLimit(pageNum,pageSize);
        return OrderList;
    }

//    取消订单
    @RequestMapping("deleteOrderByid")
    public Object deleteOrderByid(Integer id){
        Boolean state=orderService.deleteById(id);
        return state;
    }
}